<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>Insert title here</title>
    <script>
        function onBridgeReady1() {
            WeixinJSBridge.invoke('getBrandWCPayRequest', {
                "appId": "wxfe37ddbe2dde921b",
                "timeStamp": document.getElementById("l").value,
                "nonceStr": document.getElementById("nonceStr").value,
                "package": document.getElementById("prepayId").value,
                "signType": "RSA",
                "paySign": document.getElementById("sign").value
            },
            function(res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    // 使用以上方式判断前端返回,微信团队郑重提示：
                    //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                    window.location.href = "index.html"
                }
            });
        }

        function get() {
            alert(document.getElementById("l").value);
            alert(document.getElementById("nonceStr").value);
            alert(document.getElementById("prepayId").value);
            alert(document.getElementById("sign").value);
        }
    </script>
</head>

<body>
<h1>this is the hello.html in templates</h1>
<h3 th:text="${newText}"></h3>
<!-- 属性替换，其他属性同理 -->
<input id="l"type="text" th:value="${l}"></input>
<input id="nonceStr"type="text" th:value="${nonceStr}"></input>
<input id="prepayId"type="text" th:value="${prepayId}"></input>
<input id="sign"type="text" th:value="${sign}"></input>

<div onclick="get()">单击</div>
<div onclick="onBridgeReady1()">单击111</div>
</body>
</html>
